import { Component, OnInit } from '@angular/core';
import { RouterModule, Routes, Router } from '@angular/router';
import { DragDropModule } from 'primeng/primeng';
import { DesktopService } from './desktop.service';
import { SysNav } from './desktop.model';

@Component({
  selector: 'app-desktop',
  templateUrl: './desktop.component.html',
  styleUrls: ['./desktop.component.scss'],
  providers: [DesktopService]
})
export class DesktopComponent implements OnInit {
  sysNavs: SysNav[];
  constructor(
    private router: Router,
    private desktopService: DesktopService
  ) { }

  ngOnInit() {
    this.desktopService.getNavSystem()
      .subscribe(data => this.sysNavs = data);
  }
  /** 点击跳转到指定的系统 */
  specifySys(sysPath, sysId) {
    setTimeout(() => { this.router.navigate([sysPath, { 'sysId': sysId }]) }, 350);
  }
}
